<?php
 
$CPSList  = array('dhc.net.cn'=>'126164','.amazon.com'=>'123');

//http://count.chanet.com.cn/click.cgi?a=237674&d=126163&u=&e=&url=
//http://count.chanet.com.cn/click.cgi?a=237674&d=126165&u=&e=&url=dangdang
//http://count.chanet.com.cn/click.cgi?a=237674&d=126166&u=&e=&url=360buy

define('CPS_LINK',''); 
 

function GetCPSURL($URL,$CPSList){


    if(!edp_is_empty_string(CheckCPSSupport($URL,$CPSList))){

 		//如果支持cps，返回拼接的链接   	
    	return CPS_LINK.$URL;
    	
    }else{
    	
   		//否则返回原来链接	
    	return $URL;
    }	       		
}

    //是否支持cps
function CheckCPSSupport($URL,$CPSList){
		
	foreach($CPSList as $key=>$value){	
		
		if(strpos($URL,$key))
				
		 return $value;		 
	
	}
	return '';
}

     
?>